﻿<presentation:UserControlView x:Class="Chronos.Client.Win.Views.ProcessShadow.WinApplication.View"
                              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                              xmlns:presentation="clr-namespace:Rhiannon.Windows.Presentation;assembly=Rhiannon.Windows"
                              xmlns:commanding="clr-namespace:Rhiannon.Windows.Presentation.Commands;assembly=Rhiannon.Windows"
                              xmlns:converters="clr-namespace:Rhiannon.Windows.Presentation.Converters;assembly=Rhiannon.Windows"
                              xmlns:controls="clr-namespace:Rhiannon.Windows.Controls;assembly=Rhiannon.Windows"
                              x:Uid="Profiler_ProcessShadow_WinApplicationView">
	<presentation:UserControlView.Resources>
        <converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
		<Style x:Key="MenuToggleButtonStyle" TargetType="{x:Type ToggleButton}">
			<Setter Property="Cursor" Value="Hand" />
			<Setter Property="Height" Value="40" />
			<Setter Property="Foreground" Value="#000000" />
            <Setter Property="Margin" Value="0" />
            <Setter Property="Padding" Value="10" />
            
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type ToggleButton}">
						<Border Name="Border">
							<Grid>
								<ContentPresenter Name="ContentPresenter" TextBlock.FontSize="19" TextBlock.Foreground="{TemplateBinding Foreground}" 
												  TextBlock.FontWeight="Thin" Margin="{TemplateBinding Padding}" VerticalAlignment="Center" HorizontalAlignment="Center" />
								<Border Name="Underline" Background="#31B6FD" Height="2" Visibility="Hidden" VerticalAlignment="Bottom" />
							</Grid>
						</Border>
						
						<ControlTemplate.Triggers>
							<Trigger Property="IsMouseOver" Value="True">
								<Setter TargetName="ContentPresenter" Property="TextBlock.Foreground" Value="#2a9cd9" />
							</Trigger>
							<Trigger Property="IsChecked" Value="True">
								<Setter TargetName="ContentPresenter" Property="TextBlock.Foreground" Value="#2a9cd9" />
                                <Setter TargetName="Underline" Property="Visibility" Value="Visible" />
                                <!--<Setter TargetName="Border" Property="Background" Value="#ffffff" />-->
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
	</presentation:UserControlView.Resources>
	<Grid>
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        <Grid Grid.Row="0" Grid.Column="0">
            <Border Background="#EEEEEE" BorderBrush="#DDDDDD" BorderThickness="0,1,0,0">
                <ItemsControl ItemsSource="{Binding Documents}">
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <ToggleButton Style="{StaticResource MenuToggleButtonStyle}" Content="{Binding Title}"
                                          IsChecked="{Binding IsActive}" />
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                    <ItemsControl.ItemsPanel>
                        <ItemsPanelTemplate>
                            <StackPanel Orientation="Horizontal" IsItemsHost="True" />
                        </ItemsPanelTemplate>
                    </ItemsControl.ItemsPanel>
                </ItemsControl>
            </Border>
        </Grid>
        <Grid Grid.Row="1" Grid.Column="0" Margin="10">
			<ContentControl HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Content="{Binding Documents.ActiveDocument.View}" />
        </Grid>
        <Button Grid.Row="2" Content="Reload data" HorizontalAlignment="Stretch" Height="35" FontSize="16"
                        commanding:Event.Command="{Binding ReloadProcessShadowCommand}"
                        Visibility="{Binding IsEnabled, RelativeSource={RelativeSource Self}, Converter={StaticResource BoolToVisibilityConverter}}"
                        ToolTip="Reload data">
        </Button>
        <Border Grid.RowSpan="3" Grid.Column="1" Background="#31B6FD" BorderThickness="1,0,0,0">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Button Grid.Row="0" Style="{DynamicResource BlurlessImageButton}"
                        commanding:Event.Command="{Binding StopProfilingCommand}"
                        Visibility="{Binding IsEnabled, RelativeSource={RelativeSource Self}, Converter={StaticResource BoolToVisibilityConverter}}"
                        ToolTip="Stop profiling (profiled process will be closed)">
                    <controls:BlurlessImage Source="pack://application:,,,/Chronos.Client.Win;component/Resources/images/stop.png" />
                </Button>
                <Button Grid.Row="1" Style="{DynamicResource BlurlessImageButton}"
                        commanding:Event.Command="{Binding ContinueProfilingCommand}"
                        Visibility="{Binding IsEnabled, RelativeSource={RelativeSource Self}, Converter={StaticResource BoolToVisibilityConverter}}"
                        ToolTip="Resume profiling">
                    <controls:BlurlessImage Source="pack://application:,,,/Chronos.Client.Win;component/Resources/images/start.png" />
                </Button>
                <Button Grid.Row="1" Style="{DynamicResource BlurlessImageButton}"
                        commanding:Event.Command="{Binding PauseProfilingCommand}"
                        Visibility="{Binding IsEnabled, RelativeSource={RelativeSource Self}, Converter={StaticResource BoolToVisibilityConverter}}"
                        ToolTip="Pause profiling">
                    <controls:BlurlessImage Source="pack://application:,,,/Chronos.Client.Win;component/Resources/images/pause.png" />
                </Button>
            </Grid>
        </Border>
	</Grid>
</presentation:UserControlView>